package com.tools.genxsd.entity.type;

import com.tools.genxsd.entity.XsdBaseType;
import com.tools.genxsd.entity.XsdDocument;
import lombok.Data;

/**
 * 属性节点
 * @author: zhoubin
 * @date: 2022/11/9
 */
@Data
public class XsdAttributeType extends XsdBaseType {

    /**
     * 节点名
     */
    private String name;

    /**
     * 属性名
     */
    private String attrName;

    /**
     * 基本类型
     */
    private XsdBaseType baseType;

    /**
     * 属性类型
     */
    private XsdBaseType attrType;

    /**
     * 是否必须
     */
    private String use;

    public XsdAttributeType(String name, String attrName, XsdBaseType baseType, XsdBaseType attrType, String use) {
        this.setName(name);
        this.attrName = attrName;
        this.baseType = baseType;
        this.attrType = attrType;
        this.use = use;
    }

    @Override
    public void addToDocument(XsdDocument document) {
        document.getGenerate().addAttributeType(this);
    }
}
